package demo13;

import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        int q = scanner.nextInt();
        while (q-- > 0){
            int a = scanner.nextInt();
            int b = scanner.nextInt();
            int c = scanner.nextInt();
            int x = Math.min(a,Math.min(b,c));
            int score = 2*x;
            if (b - x > 1){
                score += (b - x - 1);
            }
            System.out.println(score);
        }
    }
}
